@extends('admin/layout.app')

@section('title', '菜单管理')

@section('content')
    @if($menu_list)
        <form action="/admin/menu/sort" method="post">
        <table class="list_tab menu_table">
            <thead>
            <tr>
                <th>排序<button type="submit" class="btn btn-warning btn-xs">排序</button></th>
                <th>ID</th>
                <th>URL</th>
                <th>路由名称</th>
                <th>菜单名称</th>
                <th>状态</th>
                <th>操作</th>
            </tr>
            </thead>
            <tbody>
            @foreach($menu_list as $item)
                <tr id="menu-{{ $item['id'] }}" class="menu {{ $item['parent_id'] !=0 ? 'hidden' : '' }}" data-parent="{{ $item['parent_id'] !=0 ? 'menu-'.$item['parent_id'] : '' }}">
                    <td>
                        {{ str_repeat('&nbsp;&nbsp;&nbsp;&nbsp;',$item['level']) }}
                        <i class="menu-arrow role-arrow-switch"></i>
                        {{csrf_field()}}
                        <input type="hidden" name="menu_ids[]" value="{{$item['id']}}" />
                        <input type="text" name="sort_nums[]" value="{{$item['sort']}}" class="form-control" /></td>
                    <td>{{$item['id']}}</td>
                    <td>{{ $item['parent_id'] == 0 ? '' : $item['url']}}</td>
                    <td>{{ $item['route_name'] }}</td>
                    <td>{{ str_repeat('|--',$item['level']) }}{{$item['name']}}</td>
                    <td><span class="{{$item['status'] == 1 ? 'status-normal' : 'disable' }}">{{$item['status'] == 1 ? '正常' : '禁用' }}</span>
                    <td>
                        <a href="/admin/menu/{{ $item['id'] }}/edit" class="text-info" title="编辑菜单" data-toggle="tooltip"><i class="edit-icon" ></i></a>
                        <a href="" class="show-dialog  text-warning"  data-id="{{$item['id']}}" data-type="menu" title="删除" data-toggle="tooltip"><i class="remove-icon" ></i></a>
                    </td>
                </tr>
            @endforeach
            </tbody>
        </table>
        </form>
    @endif
@endsection
